package ltd.dujiabao.eduvod.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author : DuJiabao
 * @Project : online-course-project
 * @Time : 2021/4/20 19:50
 * @Desc : afterPropertiesSet 方法在创建的时候就立即执行.
 * 个人理解，因为不想取对象出来，又想取值，所以用这种方式，优美的在实例化的时候将值付给静态量，直接通过类来取就好了
 */
@Component
public class ConstantPropertiesUtil implements InitializingBean {
  @Value("${aliyun.vod.file.keyid}")
  private String keyId;
  @Value("${aliyun.vod.file.keysecret}")
  private String keySecret;
  @Value("${aliyun.vod.file.regionId}")
  private String regionId;

  public static String KEY_ID;
  public static String KEY_SECRET;
  public static String REGION_ID;

  @Override
  public void afterPropertiesSet() throws Exception {
    KEY_ID = keyId;
    KEY_SECRET = keySecret;
    REGION_ID = regionId;
  }
}
